package com.hikeen.launcherx.functions.wifi;

import com.hikeen.launcherx.R;

/**
 * Author by LY
 * Email 1078410438@qq.com
 * Date on 2022/3/17.
 */
public class WIFIState {

    private static WIFIState Instance;

    private int WIFIRSSI = -1;
    private boolean STATE = false;
    private boolean HaveNetwork = false;

    private WIFIState() {
    }

    public synchronized static WIFIState getInstance() {

        if (Instance == null) {
            Instance = new WIFIState();
        }
        return Instance;
    }

    public int getWIFIRSSI() {
        return WIFIRSSI;
    }

    public void setWIFIRSSI(int WIFIRSSI) {
        this.WIFIRSSI = WIFIRSSI;
    }

    public boolean isSTATE() {
        return STATE;
    }

    public void setSTATE(boolean STATE) {
        this.STATE = STATE;
    }

    public boolean isHaveNetwork() {
        return HaveNetwork;
    }

    public void setHaveNetwork(boolean haveNetwork) {
        HaveNetwork = haveNetwork;
    }

    public int getICON() {
        if (!STATE) {
            return R.mipmap.icon_wifi_0;
        }
        if (!isHaveNetwork()) {
            return R.mipmap.icon_wifi_4;
        }

        if (70 < WIFIRSSI && WIFIRSSI <= 100) {
            return R.mipmap.icon_wifi_3;
        } else if (30 <= WIFIRSSI && WIFIRSSI <= 70) {
            return R.mipmap.icon_wifi_2;
        } else if (0 < WIFIRSSI && WIFIRSSI < 30) {
            return R.mipmap.icon_wifi_1;
        } else {
            return R.mipmap.icon_wifi_0;
        }
    }
}
